package com.egene.tw.api;


import com.egene.tw.network.ApiConstant;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

import static com.egene.tw.network.ApiHttpClient.post;

/**
 * 
 * @author WZX create by 2015/5/18
 */
public class EgeneApi{
	public final static String API_URL = ApiConstant.API_URL;

	/**
	 * 文章分类：3：成人医学 4：儿童保健 5：医学美容
	 * @param categoryid
	 * @param page
	 * @param handler
	 */
	private static void getWikiArticleList(String categoryid, int page, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetSupportAppArticleList");
		params.put("pageindex", page);
		params.put("categoryid", categoryid);
		post(API_URL, params, handler);
	}

	/**
	 * 获取 成人医学 文章
	 * @param page
	 * @param handler
	 */
	public static void getWikiAboutList(int page, AsyncHttpResponseHandler handler) {
		getWikiArticleList("3", page, handler);
	}

	/**
	 * 获取 儿童保健 文章
	 * @param page
	 * @param handler
	 */
	public static void getWikiChildList(int page, AsyncHttpResponseHandler handler) {
		getWikiArticleList("4", page, handler);
	}

	/**
	 * 获取 医学美容 文章
	 * @param page
	 * @param handler
	 */
	public static void getWikiBeautyList(int page, AsyncHttpResponseHandler handler) {
		getWikiArticleList("5", page, handler);
	}


	/**
	 * 获取 小百科文章 详情
	 * @param id
	 * @param handler
	 */
	public static void getWikiArticleInfo(String id, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetArticleDetail");
		params.put("id", id);
		post(API_URL, params, handler);
	}

	/**
	 * 产品列表
	 * @param id
	 * @param handler
	 */
	public static void getProductList(String id, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetProductCategory");
		params.put("id", id);
		post(API_URL, params, handler);
	}

	/**
	 * 产品详细
	 * @param id
	 * @param handler
	 */
	public static void getProductInfo(String id, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetProductCategoryInfo");
		params.put("id", id);
		post(API_URL, params, handler);
	}

	/**
	 * 套餐列表
	 * @param id
	 * @param handler
	 */
	public static void getPackageList(String id, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetProductPackage");
		params.put("id", id);
		post(API_URL, params, handler);
	}

	/**
	 * 套装详细
	 * @param id
	 * @param handler
	 */
	public static void getPackageInfo(String id, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetProductPackageInfo");
		params.put("id", id);
		post(API_URL, params, handler);
	}

    /**
     * 获取个人中心首页聚合数据
     * @param userId
     * @param handler
     */
	public static void getUserCenter(String userId, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.UserCenter");
		params.put("userid", userId);
		post(API_URL, params, handler);
	}

	/**
	 * 获取认识自己列表
	 * @param userId
	 * @param handler
	 */
	public static void getUserCenterList(String userId, int parentId, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetUserCenterSwitchCatetoryList");
		params.put("userid", userId);
		if(parentId != -1)
			params.put("parentid", parentId);
		post(API_URL, params, handler);
	}

	public static void getUserCenterList(String userId, AsyncHttpResponseHandler handler) {
		getUserCenterList(userId, -1, handler);
	}

	/**
	 * 获取健康管理列表
	 * @param userId
	 * @param handler
	 */
	public static void getHealthList(String userId, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetUserCenterHealthyList");
		params.put("userid", userId);
		post(API_URL, params, handler);
	}

	/**
	 * 获取用户检查报告
	 * @param userId
	 * @param handler
	 */
	public static void getUserReport(String userId, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetUserReport");
		params.put("userid", userId);
		post(API_URL, params, handler);
	}

	public static void getHealthListByType(String userId, String type, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetUserCenterHealthyListByType");
		params.put("userid", userId);
		params.put("TYPE", type);
		post(API_URL, params, handler);
	}

	public static void getGirlMM(String userId, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetGirlMMLoginID");
		params.put("userid", userId);
		post(API_URL, params, handler);
	}


	public static void getPersonalProjectList(String userId, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetUserCenterPersonCareplanMore");
		params.put("userid", userId);
		post(API_URL, params, handler);
	}

	public static void getGetPersonOrderList(String userId, AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetPersonOrderList");
		params.put("userid", userId);
		post(API_URL, params, handler);
	}

	public static void getMoreDetail(String userId,String rid,String orderId ,AsyncHttpResponseHandler handler) {
		RequestParams params = new RequestParams();
		params.put("cmd", "ServerHandler.GetUserCenterPersonCareplanMoreDetail");
		params.put("userid", userId);
		params.put("rid", rid);
		params.put("orderId", orderId);
		post(API_URL, params, handler);
	}

}
